# 导包
import jsonschema

# 定义 jsonschema 被校验数据
dict1 = {'success': True,
         'code': 10000,
         'message': '操作成功！',
         'data': '7438342e-7240-45ee-9723-0089163856cb'}

# 定义 jsonschema校验规则
schema1 = {
    "type": "object",
    "properties": {
        "success": {"type": "boolean"},
        "code": {"type": "integer"},
        "message": {"type": "string"},
        "data": {"type": "string"}
    },
    "required": ["success", "code", "message", "data"]
}

# 进行校验
resp = jsonschema.validate(instance=dict1, schema=schema1)
print(resp)
